package cn.jtool.dig.server.controller;

import cn.jtool.dig.server.domain.reqeust.LicenseQueryRequest;
import cn.jtool.dig.server.service.DataReportService;
import cn.jtool.dig.server.service.LicenseService;
import cn.jtool.knife.core.result.ResultEntity;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/data-report")
public class DataReportController {

    @Resource
    private DataReportService dataReportService;

    @GetMapping(value = "/connect", name = "连接报表", produces = "application/json")
    public ResponseEntity<ResultEntity<?>> connect(@RequestParam(value = "page", defaultValue = "1") int page,
                                                @RequestParam(value = "limit", defaultValue = "10") int limit){
        return ResponseEntity.ok(
                ResultEntity.success(
                        this.dataReportService.connect(page, limit)
                )
        );
    }

    @GetMapping(value = "/traffic", name = "流量报表", produces = "application/json")
    public ResponseEntity<ResultEntity<?>> traffic(@RequestParam(value = "page", defaultValue = "1") int page,
                                                @RequestParam(value = "limit", defaultValue = "10") int limit){
        return ResponseEntity.ok(
                ResultEntity.success(
                        this.dataReportService.traffic(page, limit)
                )
        );
    }

}
